package com.qf.controller;
import com.qf.borrower.Borrower;
import com.qf.loanapplication.Loanapplication;
import com.qf.service.PersonalService;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;


/**
 * @Classname PersonalController
 * @Created by  yfan
 * @Date 2020/11/11  8:57
 * @Description
 */
@RestController
public class PersonalController {
    @Autowired
    PersonalService personalService;
    @RequestMapping("findPersonal")
    public List<Borrower> findPersonal(){
        return personalService.findPersonal();
    }
//三表查
    @RequestMapping("findPartMessage")
    public List<Borrower> findPartMessage(@RequestBody Map map){
        Integer id = (Integer) map.get("id");
        String paymentStatus = (String) map.get("paymentStatus");

        return personalService.findPartMessage(id,paymentStatus);
    }
  //三表中的两表查状态
    @RequestMapping("findPartMessagePaymentStatus")
    public List<Borrower> findPartMessagePaymentStatus(@RequestBody Map map){
        Integer borrowerId = (Integer) map.get("borrowerId");
        String paymentStatus = (String) map.get("paymentStatus");

        return personalService.findPartMessagePaymentStatus(borrowerId,paymentStatus);
    }
    @RequestMapping("findPartMessageById")
    public List<Borrower> findPartMessageById(@RequestBody Map map){
//    public List<Borrower> findPartMessageByName(){
        Integer id = (Integer) map.get("id");
//             String name="宋江";
        return personalService.findPartMessageById(id);
    }
}
